package com.campus.counseling.controller;

import com.campus.counseling.model.common.Result;
import com.campus.counseling.entity.SysRegisterLog;
import com.campus.counseling.model.mapper.SysRegisterLogMapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Tag(name = "注册日志")
@RestController
@RequestMapping("/api/system/register")
@RequiredArgsConstructor
public class RegisterLogController {

    private final SysRegisterLogMapper registerLogMapper;

    @GetMapping("/log")
    @Operation(summary = "获取注册日志列表")
    public Result<List<SysRegisterLog>> getRegisterLogs() {
        // 按创建时间倒序排序,只返回最近的10条记录
        List<SysRegisterLog> logs = registerLogMapper.selectRecentLogs(10);
        return Result.success(logs);
    }
} 